package com.woniuxy.woniufp.common.model.exceptions;

import com.woniuxy.woniufp.common.model.result.enums.IErrorCode;

/**
 * 自定义的断言类
 */
public class Assert {

    public static void error(String message) {
        throw new BusinessException(message);
    }
    public static void error(IErrorCode errorCode) {
        throw new BusinessException(errorCode);
    }

    public static void error(Object obj,String message) {
        if (obj == null) {
            throw new BusinessException(message);
        }
    }

    public static void error(Object obj,IErrorCode errorCode) {
        if (obj == null) {
            throw new BusinessException(errorCode);
        }
    }

    public static void error(boolean flag,IErrorCode errorCode) {
        if (flag == true) {
            throw new BusinessException(errorCode);
        }
    }
}